package com.anti.jdbc.support;

import java.util.Iterator;
import java.util.Map;

/**
 * @Description TODO
 * @Author anTi
 * @Date 2020-10-6
 */
public class SqlArgument {
    private String text;
    private Object[] args;
    private boolean namedQuery = false;
    private Map<String, Object> paramMap;
    private String[] paramNames;
    private Object[] paramValues;

    public SqlArgument() {
    }

    public String getText() {
        return this.text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Object[] getArgs() {
        return this.args;
    }

    public void setArgs(Object[] args) {
        this.args = args;
    }

    public boolean isNamedQuery() {
        return this.namedQuery;
    }

    public void setNamedQuery(boolean namedQuery) {
        this.namedQuery = namedQuery;
    }

    public Map<String, Object> getParamMap() {
        return this.paramMap;
    }

    public void setParamMap(Map<String, Object> paramMap) {
        this.paramMap = paramMap;
        int size = paramMap.size();
        this.paramNames = new String[size];
        this.paramValues = new Object[size];
        int i = 0;
        for(Iterator iterator = paramMap.entrySet().iterator(); iterator.hasNext(); ++i) {
            Map.Entry<String, Object> entry = (Map.Entry)iterator.next();
            this.paramNames[i] = (String)entry.getKey();
            this.paramValues[i] = entry.getValue();
        }

    }

    public String[] getParamNames() {
        return this.paramNames;
    }

    public Object[] getParamValues() {
        return this.paramValues;
    }
}
